package router

import (
	"github.com/gin-gonic/gin"
	"project-deploy-service/security"

	"project-deploy-service/service"
)

func SetupRouter() *gin.Engine {
	r := gin.Default()
	r.Use(security.JwtAuthenticationTokenFilter.DoFilterInternal)
	// 注册路由并使用 fileService 的 UploadHandler 方法
	r.POST("/upload", service.FileService.UploadHandler)
	history := r.Group("/history")
	{
		history.GET("/list", service.HistoryService.List)
		history.POST("/delete", service.HistoryService.Delete)
		history.POST("rollback", service.HistoryService.Rollback)
	}
	return r
}
